package com.lzs.bootsafety.business.logs.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lzs.bootsafety.business.logs.entity.SysOperLogs;
import com.lzs.bootsafety.business.logs.entity.SysVisit;
import com.lzs.bootsafety.business.logs.mapper.SysVisitMapper;
import com.lzs.bootsafety.business.logs.service.SysVisitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * @author  zhanshi Liu
 * @date    2020/04/15
 * @website www.jhmsona.cn
 */
@Service
public class SysVisitServiceImpl implements SysVisitService {
    @Autowired
    private SysVisitMapper sysVisitMapper;
    @Override
    public int insertSelective(SysVisit sysVisit) {
        return sysVisitMapper.insertSelective(sysVisit);
    }

    @Override
    public PageInfo<SysVisit> getVisitList(SysVisit sysVisit) {
        Integer page = sysVisit.getPage();
        Integer limit = sysVisit.getLimit();
        PageHelper.startPage(page = page == null ? 1 : page,limit = limit == null ? 10 : limit);
        List<SysVisit> visitList = sysVisitMapper.selectVisitList(sysVisit);
        return new PageInfo<SysVisit>(visitList);
    }
}
